<?
require_once("../RedditApi/RedditApi.php");
/* Depending on what you want to do, there a multiple constructors, pay attention */ 

// Default constructor will return objects (eg an array of new stories, as objects) from www.reddit.com
// The following three lines will print the top "Hot" story object from www.reddit.com
$redditApi = new RedditApi();
$stories = $redditApi->Story->GetStoriesHot();


//Equivalent to above, but specifying the website. This is useful if you have another site running the reddit code (yay OSS)
/*
$redditApi = new RedditApi("www.reddit.com"); //Change www.reddit.com to whatever
$stories = $redditApi->Story->GetStoriesHot();
print_r($stories->data->children[0]);
*/

//This will get the pure json, and not convert it to an object
$redditApi = new RedditApi("www.reddit.com", "json"); //xml is another useful extension
$storiesJson = $redditApi->Story->GetStoriesHot();
print ($storiesJson);
print "\n";

//Finally, if you want to get more creative, you can create a class that implements IEndpointRetriever (see EndpointRetrievers dir)
//and then use that to handle each endpoint
//This particular sample uses UrlEndpointRetriever to generate url data that is used to retrieve the endpoints
$redditApi = new RedditApi(new UrlEndpointRetriever("www.reddit.com", "json"));
$storiesUrl = $redditApi->Story->GetStoriesHot();
print_r($storiesUrl);
